package com.rambo.baselib.util;

import java.text.SimpleDateFormat;
import java.util.Date;

/***********************************************************************
 * <p>@description:
 * <p>@author: rambo
 * <p>@version: 1.0.0
 * <p>@created on: 2022/1/18 20:13
 **********************************************************************/
public class DateUtil {
    public static String formatYyyyMmDdHhmmss(Date date){
        if(date==null)return "";
        SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return dateFormat.format(date);
    }
    public static String formatMmDdHhmm(Date date){
        if(date==null)return "";
        SimpleDateFormat dateFormat=new SimpleDateFormat("MM-dd HH:mm");
        return dateFormat.format(date);
    }
    public static String formatYyyyMmDdHhmm(Date date){
        if(date==null)return "";
        SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm");
        return dateFormat.format(date);
    }
    public static String formatYyyyMmDdHhmmss(long date){
        SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return dateFormat.format(new Date(date));
    }
}
